package course3;

public class OrderService {

    public Order createOrder(OrderDishes[] orderDishes) {
        Order order = new Order();
        double totalAmount = 0d;

        for (OrderDishes orderDish : orderDishes) {
            //把每个菜品的个数和金额相×并叠加总计
            double amount = orderDish.getDishes().getPrice() * orderDish.getCount();
            totalAmount = totalAmount + amount;
        }
        order.setTotalAmount(totalAmount);

        return order;
    }

}
